The processors in general-purpose computers, as well as those used in embedded controllers and special purpose processors, are typically programmed to handle multiple programs. To the average user, these computers seem to run all of the programs at the same time. However, these computers typically perform only one task at a time. In order to run all the programs, these computers execute a portion of the first program, then a portion of the second program, and so on for all of the active programs. This gives the user the illusion that all the programs are running at the same time.
In order for the computers to execute a portion of each of the programs, the computers have to save certain information concerning each program. For example, a computer may have to save where in the program the computer was executing, the current values of data that the computer is using in the program, the values of the registers used by the program, and other information about the program or current state of the computer. This allows the computer to reload the saved information for each program and start processing where it left off in that program.
This portion processing alone (also called time slicing), however, cannot respond to interruptions in a timely manner. For example, if a user is running a word processor program and is also downloading a song from the Internet using a browser, the computer may not return to the browser in time to save the next portion of the song that is received, which would result in gaps in the song when played. To overcome this problem, the computers typically have event handling capability. In other words, the computer can stop the normal processing, go handle an interrupt (event) and then return to normal processing. In the above example, when the computer received another portion of the song from the Internet, the computer would stop executing the word processor program and then go save the portion of the song. The computer would then return to continue executing the word processor program.
This event handling capability became more complicated as the complexity of the processors within the computers increased and as processors were dedicated for specific purposes, such as in network controllers. The types of events and the number of events also increased for these dedicated processors. For example, the events could be related to hardware conditions, such as a line available, data available and control signals. The events could also be related to what is called software events. Software events are events similar in nature to hardware events, but are generated by the software and can be related to different conditions, such as processing states. With these ever increasing types of events, the programs that handled these events needed to be able to process only certain events. To accomplish this, the processors have what is called an event mask. The event mask contains flags for each type of event that can be handled by that program. The flags in the event mask could be set to allow the program to handle only a subset of the events. This allowed the programs to be able to perform very specific functions, which resulted in the fast processing of the event.
Fast processing of events is very important, especially as the speed of the networks increase. Missing an event can mean a network packet (message) may be dropped. In addition to the increased speed, the complexity of what has to be accomplished for specific events also increased. One solution commonly employed was to use multiple event handling programs to process the event. This involved one event handling program sending another event handling program information, such as what events to process. However, due to the type of processing involved and how processors allow event handling programs to execute, the event handling programs typically could not communicate with each other directly. FIG. 1 illustrates a flow diagram of how the event handling programs accomplished the passing of information between them. More specifically, FIG. 1 illustrates how to pass and set an event mask of another event handling program.
To accomplish the communication between the event handling programs, the first event handling program would write the information to a memory location that is accessible by any event handling program (also called a global variable) in a step 110. In this example, the information to be passed from the first event handling program is an event mask. The event mask will be used by the second event handling program to set its own event mask. Next, the first event handling program would then issue a software event to the second event handling program in a step 120. The processor would then start the second event handling program in a step 130. Note that the first event handling program has stopped executing.
Next, the second event handling program would read the event mask from the global variable in a step 140. The second event handling program would then write the event mask as its own event mask in a step 150. The processor then sets the event mask of the second event handling program in a step 160. Next, the processor then returns to continue executing the first event handling program in a step 170.
The method illustrated in FIG. 1 indicates that the first event handling program has to stop processing in order to pass information concerning what events to handle to the second event handling program. Then, the second event handling program must perform several steps in order to retrieve the event information and set its own event mask before the first event handling program can continue processing. This type of information passing causes the amount of time required to process an event to be increased. In addition, the switching between event handling programs also causes additional overhead and delay because the processor has to first save processor information concerning the first event handling program, such as the information described above, and then load the processor information for the second event handling program. After the second event handling program finished setting the event mask, the processor has to save the processor information for the second event handling program and then load the processor information for the first event handling program in order to allow the first event handling program to continue processing. Due to the ever increasing speed requirements of networks and the increased complexity of the event handling to accommodate these networks, the above method of passing event information is inadequate.
Accordingly, what is needed in the art is a way to pass event information between event handling programs that overcome the deficiencies of the prior art.